﻿using System;
using System.Web.Routing;
using Microsoft.ApplicationServer.Http;
using KeanuMvc.Reference;


namespace HISRestServices {

    public class Global : System.Web.HttpApplication {

        protected void Application_Start(object sender, EventArgs e) {
            RegisterRoute();
        }

        private void RegisterRoute() {
            var config = new WebApiConfiguration() { EnableHelpPage = true, EnableTestClient = true };
            config.Formatters.XmlFormatter.UseDataContractSerializer = true;
            config.Formatters.Add(new JsonNetMediaTypeFormatter());
            config.MaxReceivedMessageSize = 2097151;
            config.MaxBufferSize = 2097151;
            //config.MessageHandlers.Add(typeof(ServiceWeb.Libs.ApiKeyVerificationChannel));
            RouteTable.Routes.SetDefaultHttpConfiguration(config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.Sys>("sys", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.FrontOffice>("fo", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.Purchase>("prc", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.Physician>("phy", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.Ref>("ref", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.Master>("master", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.MedicalRecord>("mr", config);
            RouteTable.Routes.MapServiceRoute<HISRestServices.Services.Workflow>("wf", config);
        }

        protected void Session_Start(object sender, EventArgs e) {

        }

        protected void Application_BeginRequest(object sender, EventArgs e) {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e) {

        }

        protected void Application_Error(object sender, EventArgs e) {

        }

        protected void Session_End(object sender, EventArgs e) {

        }

        protected void Application_End(object sender, EventArgs e) {

        }
    }
}